//
//  ReturnSign.m
//  RENTVISITOR
//
//  Created by wonder on 2017/9/11.
//  Copyright © 2017年 UNN. All rights reserved.
//

#import "ReturnSign.h"
#import "Utils.h"

@implementation ReturnSign

+(NSString *)returnSignWithDic:(NSDictionary *)dic {
    
    NSDictionary *params = [Utils nullDic:dic];
    
    NSArray *keyArray = [params allKeys];
    
    NSArray *sortArray = [keyArray sortedArrayUsingComparator:^NSComparisonResult(id  _Nonnull obj1, id  _Nonnull obj2) {
        return [obj1 compare:obj2 options:NSNumericSearch];
    }];
    
    NSMutableArray *valueArray = [NSMutableArray array];
    for (NSString *sortString in sortArray) {
        [valueArray addObject:[params objectForKey:sortString]];
    }
    
    NSMutableArray *signArray = [NSMutableArray array];
    for (int i = 0; i < sortArray.count; i++) {
        NSString *keyValueStr = [NSString stringWithFormat:@"%@",valueArray[i]];
        [signArray addObject:keyValueStr];
    }
    
    NSString *sign = [signArray componentsJoinedByString:@""];
    return sign;
    
    
    
    
    return nil;
    
}
@end
